package LOGIN;

import Service.impl.StuServiceImpl;
import entity.Student;
import mapper.impl.StudentMapperImpl;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@WebServlet("/stf")

public class StudentFrom extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        StuServiceImpl stuS = new StuServiceImpl();
        List<Student> students = stuS.SelectAll();
        req.setAttribute("stuAll",students);
        System.out.println(students);
//        ServletContext context = req.getServletContext();
//        context.setAttribute("stuAll",students);
        req.getRequestDispatcher("/WEB-INF/Succes.jsp").forward(req,resp);
    }
}
